-
Notifications
You must be signed in to change notification settings - Fork 14
🤖 feat: add guard-anchored file_edit_insert tool #579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
5f3cdbc to
3791c66
Compare
565c5eb to
79e3c6b
Compare
The file_edit_insert tool led to more issues than benefits (unreliable line offset calculations and edge cases). Standardize on file_edit_replace_string as the primary file editing tool. Changes: - Remove file_edit_insert tool and all references - Remove from tool definitions and type exports - Update UI components to only support replace_string and replace_lines - Update tests and tool policies - Update integration tests to use file_edit_replace_string All 987 unit tests pass; typecheck is clean.
Generated with `mux`
Generated with
Generated with
Generated with
Generated with
Generated with
73098b7 to
d9622c3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| function insertContent( | ||
| originalContent: string, | ||
| contentToInsert: string, | ||
| options: InsertContentOptions | ||
| ): InsertOperationSuccess | InsertOperationFailure { | ||
| const { before, after } = options; | ||
|
|
||
| if (before !== undefined && after !== undefined) { | ||
| return guardFailure("Provide only one of before or after (not both)."); | ||
| } | ||
|
|
||
| if (before === undefined && after === undefined) { | ||
| return guardFailure("Provide either a before or after guard to anchor the insertion point."); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allow file_edit_insert to work on existing empty files
The new insert helper always returns an error when neither before nor after guards are provided, which means there is no way to write into an existing empty file—the file has no substrings to anchor against, and the create flag is ignored once the file already exists. Any invocation against a zero‑byte file will therefore always fail with “Provide either a before or after guard…”, making the tool unusable for initializing empty files (a capability the previous line_offset API supported). Consider falling back to inserting at the top of the file when it is empty or when guards are omitted, so agents can still populate empty files without resorting to other tools.
Useful? React with 👍 / 👎.
Summary
Testing
Generated with
mux